package sindconsole.auth.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.security.Principal;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserPrincipal implements Principal, Serializable {

    Account accout;
    User user;

    public Long getId() {
        return user != null ? user.getId() : null;
    }

    @Override
    public String getName() {
        return accout != null ? accout.getUsername() : null;
    }

}
